package cn.whpu.controller;


import cn.whpu.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
public class JsonController {

    @RequestMapping("/test1")
    @ResponseBody
    public User test1(){
        User user =new User();
        user.setId(1);
        user.setUsername("呀呀呀呀");
        user.setPassword("1111");
        return user;
    }

    @RequestMapping("/test2")
    @ResponseBody
    public List<User> test2(){
        List<User> list=new ArrayList();
        for (int i = 0; i < 5; i++) {
            User user =new User();
            user.setId(1);
            user.setUsername("呀呀呀呀");
            user.setPassword("1111");
            list.add(user);
        }
        return list;
    }
}
